package com.farsunset.cim.client.android;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * Instant message content.
 * @author
 */
public class CmdInfo {
    private static final int MSG_MAX_LENGTH = 1024;
    private final int cmdType;
    private final String Paramvalue;

    /**
     * Chat message.
     * @param cmdtype 指令类型.
     * @param paramvalue 指令参数.
     */
    public CmdInfo(int cmdtype, String paramvalue) {
    	cmdType = cmdtype;
    	Paramvalue = paramvalue;        
        if (Paramvalue.length() > MSG_MAX_LENGTH) {
            throw new IllegalArgumentException("Paramvalue max length is " + MSG_MAX_LENGTH);
        }
    }

    public int getCmdType() {
        return cmdType;
    }

    public String getParamValue() {
        return Paramvalue;
    }  

    /** {@inheritDoc} */
    @Override
    public String toString()
    {
        return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
        .append("cmdType", cmdType)
        .append("Paramvalue", Paramvalue)
        .toString();
    }
}
